package com.chenjun.designpattern.behavior.command;

import java.util.ArrayList;
import java.util.List;


public class 简单的命令模式雏形
{
	public static void main(String[] args)
	{
		List<Command> commandList = new producer().getCommandList();
		for(Command cmd : commandList)
		{
			cmd.execute();
		}
	}
}

interface Command
{
	public abstract void execute();
}

class Engineer implements Command
{
	@Override
	public void execute()
	{
		System.out.println("Engineer execute()");
	}
}

class Programmer implements Command
{
	@Override
	public void execute()
	{
		System.out.println("Programmer execute()");
	}
}

class producer
{
	public List<Command> getCommandList()
	{
		List<Command> list = new ArrayList<Command>();
		list.add(new Engineer());
		list.add(new Programmer());
		return list;
	}
}